package com.formiaomiao.demain.activity;

import android.os.Bundle;
import android.view.View;

import com.formiaomiao.demain.R;
import com.formiaomiao.demain.base.BaseActivity;
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer;

import butterknife.BindView;
import butterknife.ButterKnife;

public class VideoActivity extends BaseActivity {

    @BindView(R.id.detail_player)
    StandardGSYVideoPlayer detailPlayer;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_video);
        ButterKnife.bind(this);
        ViewInit();
    }

    private void ViewInit() {
        detailPlayer.setUpLazy(getIntent().getStringExtra("url"), true, null, null, "");
        //增加title
        detailPlayer.getTitleTextView().setVisibility(View.GONE);
        //设置返回键
        detailPlayer.getBackButton().setVisibility(View.GONE);
        //设置全屏按键功能
        detailPlayer.getFullscreenButton().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                detailPlayer.startWindowFullscreen(VideoActivity.this, false, true);
            }
        });
        //防止错位设置
//        detailPlayer.setPlayTag(TAG);
//        detailPlayer.setPlayPosition(position);
        //是否根据视频尺寸，自动选择竖屏全屏或者横屏全屏
        detailPlayer.setAutoFullWithSize(true);
        //音频焦点冲突时是否释放
        detailPlayer.setReleaseWhenLossAudio(false);
        //全屏动画
        detailPlayer.setShowFullAnimation(true);
        //小屏时不触摸滑动
        detailPlayer.setIsTouchWiget(false);
    }
}
